package com.oj.core.entity;

import com.oj.api.core.domain.ProblemInfo;
import com.oj.common.data.BaseEntity;
import lombok.*;

import javax.persistence.*;
import java.util.List;
import java.util.Set;

/**
 * 题目实体
 * Created by Bing on 2018/5/4.
 */
@Entity(name = "CORE_PROBLEM")
@Table(indexes = {
        @Index(name = "core_idx_code_problem", unique = true, columnList = "code"),
        @Index(name = "pms_idx_updatetime_problem", columnList = "UPDATE_TIME")
})
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class ProblemEntity extends BaseEntity<ProblemInfo>{

    /**
     * 描述 md
     */
    @Column(name="problem_desc",length = 2000)
    private String describe;

    /**
     * 描述 html
     */
    @Column(name="problem_desc_html",length = 2000)
    private String describeHtml;

    private String author,company,testDataCode;

    /**
     * 难度，分数
     */
    protected Integer degree,score;

    /**
     * 限制内存，限制时间
     */
    protected Long limitMoney,limitTime;

    /**
     * 题库集大类
     */
    @ManyToMany(mappedBy = "problems", fetch = FetchType.LAZY)
    private Set<ProblemSetEntity> problemSets;

    @Override
    protected ProblemInfo createInfo() {
        return new ProblemInfo();
    }

}
